Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
Introduction
The storage utilities cover many typical usage of storage system by part editors.
Storage Utilities
void ODSUAddPropValue(Environment* ev,
ODStorageUnit* su,
ODPropertyName prop,
ODValueType val);
Given a storage unit, add the specified property and value to the storage unit. If the property or value already exists, it will simply focus the storage unit.
void ODSUForceFocus(Environment* ev,
ODStorageUnit* su,
ODPropertyName prop,
ODValueType val);
Given a storage unit, this function focuses the storage unit to the specified property and value. If the property or value does not exist, this function will add it to the storage unit.
ODBoolean ODSUExistsThenFocus(Environment* ev,
ODStorageUnit* su,
ODPropertyName prop,
ODValueType val);
If the part editor calls ODStorageUnit::Focus on a storage unit which does not have the specified property or value, an exception is thrown. One way to avoid this exception is to call ODStorageUnit::Exists to check to see whether the property or value is there before calling ::Focus. This function calls Exists and then Focus to ensure that an exception of such type will not be thrown. If the focus is successful, kODTrue is returned. Otherwise, kODFalse is returned.
void ODSURemoveProperty(Environment* ev,
ODStorageUnit* su,
ODPropertyName prop);
This procedure removes the specific property from the storage unit.
This function returns a Platform File object (see Platform File documentation) given a file container. If any container other than a file container is passed in, the behavior is unpredictable. Using this function on a container of an unknown type is not recommended.
Given the file spec, this function creates an in-memory container of the specified type.
ODContainer* GetMemoryContainer(Environment* ev,
ODSession* session,
ODHandle handle,
ODContainerType containerType);
Given the file spec, this function returns an in-memory container of the specified type which already exists.
ODULong StorageUnitGetValue(ODStorageUnit* su, Environment* ev,
ODULong size, void *buffer);
This function gets the data from a value and returns the data in the specified buffer. In this way, the caller does not have to deal with ODByteArray directly. However, this function requires one extra copy. Hence it is not as efficient as using the ODStorageUnit API directly.
This function is similar to StorageUnitGetValue. The difference is that this function works with an ODStorageUnitView object.
void StorageUnitSetValue(ODStorageUnit* su, Environment* ev,
ODULong size, const void *buffer);
This function sets the data in a value given the size and the pointer to a buffer containing the data. In this way, the caller does not have to deal with ODByteArray directly. However, this function requires one extra copy. Hence it is not as efficient as using the ODStorageUnit API directly.
This function sets promise data in a value given the size and the pointer to a buffer containing the promise. In this way, the caller does not have to deal with ODByteArray directly. However, this function requires one extra copy. Hence it is not as efficient as using the ODStorageUnit API directly.
ODBoolean StorageUnitGetStylFromStyledText(ODStorageUnit* su,
Environment* ev,
ODULong* size,
ODPtr* styl);
This function returns the size and the data of the style information stored in the contents property of the storage unit.